package cyc.learn.mode.factory.ordinary;

public class SendFactoryTest {
    public static void main(String[] args) {
        SendFactory factory = new SendFactory();
        Sender sender = null;
        try {
            sender = factory.produceSender("sms");
            sender.send();

            sender = factory.produceSender("email");
            sender.send();

            sender = factory.produceSender("error");
            sender.send();
        } catch (Exception e) {
            //当type错误时做相应的处理
            e.printStackTrace();
        }
        System.out.println("执行完毕");

    }
}
